

begin 

   grib_names = (/ "10U_GDS4_SFC", "10V_GDS4_SFC"/) 
   ncl_names  = (/ "u10", "v10"/) 

   datelist = asciiread("list_date_2012",-1,"string") 

   nd = dimsizes(datelist) 

   year = "2012" 

   do id = 0, nd-1 

      rpath = "/glade/p/rda/data/ds113.0/surface/" 

      fna = rpath + "od_oper_an_sfc_"+year+datelist(id)+".regn640.grb"  

      print("read file "+fna) 
 
      fla = addfile(fna,"r")

      ;; names  = getfilevarnames(fla)   ; extract ALL variable names

      fno = "ecmwf_surf_"+year+datelist(id)+".nc" 

      system("rm "+fno) 

      ncdf_out = addfile(fno,"c")   

      ;***************************************************
      ; loop over selected variables and rename on output
      ;***************************************************

      do i=0, dimsizes(ncl_names)-1  
         print("output variable : "+ncl_names(i))   
         ncdf_out->$ncl_names(i)$ = fla->$grib_names(i)$ 
      end do   

   end do 


end 


